Support building with embedded glib
authorColin Walters <walters@verbum.org>
Thu, 7 Jun 2012 21:21:55 +0000 (17:21 -0400)
committerColin Walters <walters@verbum.org>
Thu, 14 Jun 2012 17:45:59 +0000 (13:45 -0400)
Makefile-daemon.am
Makefile-libostree.am
Makefile-ostadmin.am
Makefile-ostree.am
Makefile-otutil.am
Makefile-triggers.am
Makefile.am
configure.ac
embedded-dependencies/Makefile.am [new file with mode: 0644]
embedded-dependencies/Makefile.bootstrap [new file with mode: 0644]
embedded-dependencies/README [new file with mode: 0644]

index 3b0a2b34d38a6ffc2c558b3d1bedd386aeffcb4d..caa97f2e38f432890697d7a0cce5c56507fee25c 100644 (file)
@@ -24,5 +24,5 @@ ostreed_SOURCES = src/daemon/ostreed.c \
        src/daemon/ot-daemon.c \
        $(NULL)
 
-ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-ostreed_LDADD = libotutil.la libostree.la $(OT_DEP_GIO_UNIX_LIBS)
+ostreed_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/daemon -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostreed_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS)
index af5a9af9638c95492a05ef99471d60ad34727479..2d2b3b228afe14057cf2b6c033bb5e992c39b196 100644 (file)
@@ -46,9 +46,9 @@ libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
        $(NULL)
 endif
 
-libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
+libostree_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
 libostree_la_LDFLAGS = -avoid-version -Bsymbolic-functions
-libostree_la_LIBADD = libotutil.la $(OT_DEP_GIO_UNIX_LIBS)
+libostree_la_LIBADD = libotutil.la $(OT_INTERNAL_GIO_UNIX_LIBS)
 
 if USE_LIBARCHIVE
 libostree_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)
index 6872a21a737247548ad8a825d518c91995f291a2..f0e01127867eb85ffea7de03c414576464868e07 100644 (file)
@@ -25,5 +25,5 @@ ostadmin_SOURCES = src/ostadmin/main.c \
        src/ostadmin/ot-admin-main.c \
        $(NULL)
 
-ostadmin_CFLAGS =  $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-ostadmin_LDADD = libotutil.la libostree.la $(OT_DEP_GIO_UNIX_LIBS)
+ostadmin_CFLAGS =  $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostadmin -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostadmin_LDADD = libotutil.la libostree.la $(OT_INTERNAL_GIO_UNIX_LIBS)
index 802497491c5d3e6a7c29f5dfb7e1b519336286a9..628d9a133cc380daa8002038e47246cf169fd607 100644 (file)
@@ -46,8 +46,8 @@ ostree_SOURCES = src/ostree/main.c \
 ostree_bin_shared_cflags = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(srcdir)/src/ostree  -DLOCALEDIR=\"$(datadir)/locale\"
 ostree_bin_shared_ldadd = libotutil.la libostree.la
 
-ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_DEP_GIO_UNIX_CFLAGS)
-ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_DEP_GIO_UNIX_LIBS)
+ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
 
 if USE_LIBSOUP_GNOME
 bin_PROGRAMS += ostree-pull
index fec972a384c21956cb3b3d06abc8096d48413159..cf7c50e2b068aee84694beeb6084472256d1d949 100644 (file)
@@ -39,5 +39,5 @@ libotutil_la_SOURCES = \
        src/libotutil/otutil.c \
        src/libotutil/otutil.h \
        $(NULL)
-libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_DEP_GIO_UNIX_CFLAGS)
-libotutil_la_LIBADD = $(OT_DEP_GIO_UNIX_LIBS)
+libotutil_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/src/libotutil -DLOCALEDIR=\"$(datadir)/locale\" $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+libotutil_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS)
index f4a9e2358a9fda41bdaa88bc2932bebaee80da18..69fc7a6c11f06d26af33d18f413758e40cc064c4 100644 (file)
@@ -36,5 +36,5 @@ EXTRA_DIST += $(triggers_SCRIPTS)
 bin_PROGRAMS += ostree-run-triggers
 
 ostree_run_triggers_SOURCES = src/triggers/ostree-run-triggers.c
-ostree_run_triggers_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS)
-ostree_run_triggers_LDFLAGS = $(OT_DEP_GIO_UNIX_LIBS)
+ostree_run_triggers_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS)
+ostree_run_triggers_LDFLAGS = $(OT_INTERNAL_GIO_UNIX_LIBS)
index ed10d5cbc93b6251190756800926262c75ea9549..af358779ebdf4443fe7c8a19bc4ea923b9df869d 100644 (file)
@@ -20,6 +20,12 @@ AM_CPPFLAGS = -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
        -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28
 AM_CFLAGS = $(WARN_CFLAGS)
 
+if BUILD_EMBEDDED_GLIB
+SUBDIRS = embedded-dependencies .
+else
+SUBDIRS = .
+endif
+
 NULL = 
 BUILT_SOURCES =
 MANPAGES =
@@ -34,6 +40,24 @@ noinst_PROGRAMS =
 privlibdir = $(pkglibdir)
 privlib_LTLIBRARIES =
 
+if BUILD_EMBEDDED_GLIB
+OT_INTERNAL_GIO_UNIX_CFLAGS = \
+       -I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/include/glib-2.0 \
+       -I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/include/gio-unix-2.0 \
+       -I$(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/glib-2.0/include \
+       $(NULL)
+OT_INTERNAL_GIO_UNIX_LIBS = \
+       $(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libglib-2.0.so \
+       $(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgthread-2.0.so \
+       $(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgmodule-2.0.so \
+       $(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgobject-2.0.so \
+       $(top_builddir)/embedded-dependencies/install-glib/EMBEDGLIB/lib/libgio-2.0.so \
+       $(NULL)
+else
+OT_INTERNAL_GIO_UNIX_CFLAGS = $(OT_DEP_GIO_UNIX_CFLAGS)
+OT_INTERNAL_GIO_UNIX_LIBS = $(OT_DEP_GIO_UNIX_LIBS)
+endif
+
 include Makefile-daemon.am
 include Makefile-otutil.am
 include Makefile-libostree.am
@@ -83,3 +107,9 @@ endif
 
 release-tag:
        git tag -m "Release $(VERSION)" v$(VERSION)
+
+release-tarball-embedded:
+       git archive --format=tar --prefix=ostree-embeddeps-$(VERSION)/ HEAD > ostree-embeddeps-$(VERSION).tar.tmp
+       tar --append --exclude='.git/*' --transform='s,^embedded-dependencies/,ostree-embeddeps-$(VERSION)/embedded-dependencies/,' --file=ostree-embeddeps-$(VERSION).tar.tmp embedded-dependencies/glib
+       mv ostree-embeddeps-$(VERSION).tar{.tmp,}
+       gzip -f ostree-embeddeps-$(VERSION).tar 
index dd75a078d315d17647f9fcdb69cfeb285fd11e2b..ad5525612cfb537aa5dde51649f77c6686eab597 100644 (file)
@@ -26,12 +26,19 @@ AC_CHECK_HEADER([attr/xattr.h],,[AC_MSG_ERROR([You must have attr/xattr.h from l
 
 PKG_PROG_PKG_CONFIG
 
-GIO_DEPENDENCY="gio-unix-2.0 >= 2.28"
+AC_ARG_ENABLE(embedded-glib,
+           AS_HELP_STRING([--enable-embedded-glib], [Use embedded GLib copy]),,
+           enable_embedded_glib=no)
+AM_CONDITIONAL(BUILD_EMBEDDED_GLIB, test x$enable_embedded_glib = xyes)
+if test x$enable_embedded_glib = xyes; then
+  echo "NOTICE: Embedded glib enabled"
+else
+  GIO_DEPENDENCY="gio-unix-2.0 >= 2.28"
+  PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
+fi
 SOUP_DEPENDENCY="libsoup-2.4 >= 2.39.1"
 LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0"
 
-PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)
-
 AC_ARG_ENABLE(documentation,
               AC_HELP_STRING([--enable-documentation],
                              [build documentation]),,
@@ -44,7 +51,6 @@ if test x$enable_documentation = xyes; then
 fi
 AM_CONDITIONAL(BUILD_DOCUMENTATION, test x$enable_documentation = xyes)
 
-
 AC_ARG_WITH(soup-gnome,
            AS_HELP_STRING([--without-soup-gnome], [Do not use libsoup-gnome (implies no pull support)]),
            :, with_soup_gnome=maybe)
@@ -86,6 +92,7 @@ AM_CONDITIONAL(USE_LIBARCHIVE, test $with_libarchive != no)
 
 AC_CONFIG_FILES([
 Makefile
+embedded-dependencies/Makefile
 ])
 AC_OUTPUT
 
@@ -94,6 +101,7 @@ echo "
     ===============
 
 
+    embedded GLib: $enable_embedded_glib
     libsoup (retrieve remote HTTP repositories): $with_soup_gnome
     libarchive (parse tar files directly): $with_libarchive
 "
diff --git a/embedded-dependencies/Makefile.am b/embedded-dependencies/Makefile.am
new file mode 100644 (file)
index 0000000..3860f4c
--- /dev/null
@@ -0,0 +1,40 @@
+# Import GLib into local tree
+#
+# Copyright (C) 2012 Colin Walters <walters@verbum.org>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+build-glib/gio/libgio-2.0.la:
+       mkdir -p build-glib
+       (srcdir=$$(cd $(srcdir) && pwd); \
+        cd build-glib; \
+         $${srcdir}/glib/autogen.sh --prefix=/EMBEDGLIB --disable-introspection --disable-man --disable-gtk-doc && \
+        $(MAKE))
+
+install-glib/EMBEDGLIB/include/glib-2.0/glib.h: build-glib/gio/libgio-2.0.la
+       (top_srcdir=$$(cd $(top_srcdir) && pwd); \
+        builddir=$$(pwd); \
+        cd build-glib && \
+         rm -rf install-glib && \
+        $(MAKE) install DESTDIR=$${builddir}/install-glib)
+
+all-local: install-glib/EMBEDGLIB/include/glib-2.0/glib.h
+
+install-exec-local: 
+       echo `pwd`
+       $(MKDIR_P) $(DESTDIR)/$(pkglibdir)
+       install install-glib/EMBEDGLIB/lib/*.so.* $(DESTDIR)/$(pkglibdir)
+
diff --git a/embedded-dependencies/Makefile.bootstrap b/embedded-dependencies/Makefile.bootstrap
new file mode 100644 (file)
index 0000000..95ca2a9
--- /dev/null
@@ -0,0 +1,2 @@
+embedded-glib-download:
+       test -d glib || git clone --depth=1 git://git.gnome.org/glib -b glib-2-32 glib
diff --git a/embedded-dependencies/README b/embedded-dependencies/README
new file mode 100644 (file)
index 0000000..a76b0f6
--- /dev/null
@@ -0,0 +1,19 @@
+To support building on older systems, this infrastructure allows
+bundling libraries.  At the moment, this is just GLib.
+
+The intent of this system is that a "ostree-embeddeps.tar.gz" is
+created, which can be used as input to an RPM or Debian package, which
+can then be installed on older operating systems.
+
+To create one, use:
+
+$ cd embedded-dependencies
+$ make -f Makefile.bootstrap embedded-glib-download
+$ cd ..
+$ make release-tarball-embedded
+
+To build it:
+
+$ ./configure --enable-embedded-glib ...
+
+as usual.